home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14096 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
  2. From: grantp@usa.pipeline.com(Pete Grant)
  3. Newsgroups: comp.lang.c++,
  4. Subject: Re: Question on template-probs
  5. Date: 29 Mar 1996 02:18:14 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4jfh96$acq@news1.h1.usa.pipeline.com>
  8. References: <4jeo7o$q00@sunsystem5.informatik.tu-muenchen.de>
  9. NNTP-Posting-Host: 38.8.120.16
  10. X-PipeUser: grantp
  11. X-PipeHub: usa.pipeline.com
  12. X-PipeGCOS: (Pete Grant)
  13. X-Newsreader: Pipeline v3.5.0
  14.  
  15. On Mar 28, 1996 19:10:48 in article <Question on template-probs>,
  16. 'meisenec@informatik.tu-muenchen.de (Robert Meisenecker)' wrote: 
  17.  
  18.  
  19. >Hi, 
  20. >im an relatively unexperienced C++ programmer, which is the reason for
  21. this 
  22. >simple question (I bet it's simple for an more experienced programmer): i 
  23.  
  24. >played 
  25. >around with templates and was confronted with the following problem:  
  26. >If I use the template by creating an object of a simple type like int, the
  27.  
  28. >linker 
  29. >states that all of the member functions of the template are unknown. This 
  30.  
  31. >occurs 
  32. >only when the member functions are NOT coded inline. If the member
  33. functions  
  34. >are 
  35. >specified inline, then there is no problem with the linker. (Inline means
  36. here 
  37. >that the problem even occurs when the member functions are not specified
  38. as  
  39. >part of the class declaration, but in a source file with the leading
  40. keyword 
  41. >"inline")  
  42. >My question is: how to avoid those linker problems without declaring all 
  43. >member functions as part of the class (becomes a bit confusing when the
  44. member 
  45. >fuctions are a bit longer...) 
  46. >At first (as an experienced C-Programmer) I thougt of declaring
  47. Prototypes,  
  48. >but as I found out C++ allows only exactly one prototype, and by the way: 
  49.  
  50. >Isn't 
  51. >it the job of the compiler to create those prototypes if I create a
  52. template? 
  53. >Maybe it's a special problem of my compiler: i'm working with the Watcom
  54. C/C++ 
  55. >Compiler V.10.5. 
  56. No, it's not the compiler. 
  57.  
  58. Post a small sample of code that illustrates the problem. 
  59. Show how you define the template classes and its member 
  60. functions. 
  61.  
  62. -- 
  63. Pete Grant 
  64. Kalevi, Inc. 
  65. Software Engineering & development
  66.